FIG. 1 schematically shows a microprocessor MP with a conventional device for switching the microprocessor into a predetermined operating mode. This device comprises a counter CNTR, the output of which is applied to the central processing unit CPU of the microprocessor by a decoder DEC. The counter CNTR has a counting input E1, a reset input E2 and an input E3 for validating and locking the output of the counter. Input E1 is coupled to a terminal P1 of the microprocessor, and inputs E2 and E3 receive the reset signal (RESET) of the microprocessor. By convention, the active value of the signal RESET is considered in the following as being the value 0. The counter CNTR is inhibited and maintained at zero when the signal RESET is at 1, and is active when the signal RESET has the active value 0.
As well known by those skilled in the art, the start of a microprocessor MP begins by an initialization sequence, the duration of which corresponds to a predetermined number of clock cycles, during which the signal RESET is set to 0 (active value). The temporary setting to 0 of the signal RESET has the effect of activating the counter CNTR so that a mode selection signal MS, formed by a series of pulses, can be applied to the counting input E1 by terminal P1. When the signal RESET switches again to 1, the rising edge of this signal on the input E3 of the counter activates output latches of the counter (not shown) so that the counter delivers a number N representative of the number of pulses applied to its input E1 when the signal RESET was at 0.
The number N is received by the input of decoder DEC, which then delivers two mode bits M0 and M1 to the central processing unit CPU of the microprocessor. Only one of these two bits is at a 1 according to the value of N. Bit M1 is, for example, equal to 1 when N is between values N1 and N2, and bit M0 is at 1 when N is not between these two values N1 and N2, which thus defines a selection window for mode M1.
Mode M0 (bit M0 at 1) or a default mode of the microprocessor is generally the user mode, i.e., the normal operating mode of the microprocessor in the application for which it has been programmed. Thus, when no pulse is applied to terminal P1 during the initialization period, the microprocessor always starts in the user mode, which means that it will read the first instruction of an application program arranged in its main program memory, such as a FLASH memory (not shown), for example.
Mode M1 (bit M1 at 1) is generally a test or servicing mode, where the program counter PC of the CPU unit is directed to a predetermined address corresponding to the first instruction of a test program. Such a test program is generally provided by the manufacturer and is prerecorded in a specific memory, such as a ROM memory, for example. This test program may also be a program for loading a test program in a memory for a greater test mode flexibility.
The test mode is reserved to the servicing or the testing of the microprocessor before its first power-on. When the microprocessor is arranged on a printed circuit board and is connected to various peripheral elements, the user must never apply a series of pulses to terminal P1 during the initialization period. Thus, for switching the microprocessor into the test mode, it is generally necessary to access terminal P1 by external equipment, such as conductive tongs for example, in order to apply the pulses of a mode MS selection signal.
It is essential that the microprocessor is not going to switch involuntarily into the test mode, wherein the microprocessor would not run the application program and would not operate as it should. An involuntary start in the test mode would lead to problems in a system controlled by the microprocessor, some of which may be serious. To that effect, the numbers N1 and N2 are chosen rather close to define a narrow selection window, for example, a window ranging between 33 and 38 pulses, and may even be chosen equal for maximum security.
In spite of these precautions, experience shows that a microprocessor provided with a device of the above described type may accidentally switch into the test mode, and in particular, when the microprocessor and the printed circuit board on which it is arranged are disposed in a very noisy electromagnetic environment that is likely to generate parasitic signals on the counting input E1.
Such a selection device for the operating mode of a microprocessor has, however, the advantage of being straightforward to implement because it only requires a counter and a decoder having both a low cost and small size.